//
//  HomePage_ViewController.m
//  MagicBox
//
//  Created by dllo on 16/8/11.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HomePage_ViewController.h"
#import "Home_ZP_01View.h"
#import "HomePage.h"
@interface HomePage_ViewController ()

@property (nonatomic, retain) NSMutableArray *muarray;
@property (nonatomic, retain) Home_ZP_01View *zpview;
@property (nonatomic, retain) NSDictionary *imagedic;
@property (nonatomic, retain) NSDictionary *imagedict;

@property (nonatomic, retain) NSMutableArray *muArr;
@property (nonatomic, retain) NSMutableArray *guessArr;
@property (nonatomic, retain) NSMutableArray *funArr;
@property (nonatomic, retain) NSString *strRi;
@property (nonatomic, retain) NSString *strLi;


@end

@implementation HomePage_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   
    self.muarray = [NSMutableArray array];
    self.imagedic = [NSDictionary dictionary];
    self.imagedict = [NSDictionary dictionary];
    self.muArr = [NSMutableArray array];
    self.guessArr = [NSMutableArray array];
    self.funArr = [NSMutableArray array];
    
    self.zpview = [[Home_ZP_01View alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-SCREENHEIGHT/6.6)];
    [self.view addSubview:self.zpview];
    
    
    
    self.view.backgroundColor = AUTOCOLOR;
    [self creactNumber];

}

-(void)creactNumber{
    
    
    [CCNetTool GET:@"http://app.58.com/api/windex/api/indexnew/?indexver=1470765957458&cversion=7.0.6.1&os=android&city=dl" body:nil headerFile:nil response:CCJSON success:^(id result) {
        NSArray *data = [result objectForKey:@"data"];
        
        
        for (NSDictionary *dic in data) {
            NSDictionary *icon_list  = [dic objectForKey:@"icon_list"];
            NSArray *data = [icon_list objectForKey:@"data"];
            for (NSDictionary *dict in data){
                NSDictionary *action = [ dict objectForKey:@"action"];
                HomePage *model = [[HomePage alloc]initWithDic:action];
                [self.muarray addObject:model];
            }
            
            NSDictionary *icon_adv2 = [dic objectForKey:@"icon_adv2"];
            NSArray *data1 = [icon_adv2 objectForKey:@"data"];
            for (NSDictionary *dicc in data1) {
                
                HomePage *model1 = [[HomePage alloc]initWithDic:dicc];
                
                self.imagedic = model1.left;
                self.imagedict = model1.right;
                
                
                
            }
            
            NSDictionary *icon_third = [dic objectForKey:@"icon_third"];
            NSArray *data2 = [icon_third objectForKey:@"data"];
            for (NSDictionary *dicti in data2) {
                HomePage *model1 = [[HomePage alloc]initWithDic:dicti];
                [self.funArr addObject:model1];
                
            }
        }
        _zpview.muArr = self.muarray;
        _zpview.dicLeft = self.imagedic;
        _zpview.dicRight = self.imagedict;
        _zpview.nameArr = self.funArr;
        
        
        
        
    } failure:^(NSError *error) {
        
    }];
    NSDictionary *head = @{
                           @"version":@" 7.0.6.1",
                           @"imei":@" 864895023459090"
                           
                           };
    [CCNetTool GET:@"http://app.58.com/api/push/newgl/index/list" body:nil headerFile:head response:CCJSON success:^(id result) {
        NSDictionary *resu = [result objectForKey:@"result"];
        NSArray *list = [resu objectForKey:@"list"];
        for (NSDictionary *dic in list) {
            HomePage *model = [[HomePage alloc]initWithDic:dic];
            [self.guessArr addObject:model];
            
            
            
            
        }
        _zpview.gueArr = self.guessArr;
        
    } failure:^(NSError *error) {
        
    }];
    
    
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
